var san_yi = document.getElementById("san-cott-top-nei")
var san_er=document.getElementById("san-cott-top");
//console.log(san_yi);
//console.log(san_er);
var num=0;
var sum=0;
var timer=null;
var timers=null;
timer =setInterval(autoPaly,20);
function autoPaly(){
	num-=3;
	if (num>=-4380) {
		san_yi.style.left=num+"px";
	}else{
		num=0;
   }
}
san_er.onmouseover=function(){
		 clearInterval(timer);
		  }
san_er.onmouseout=function(){
		timer =setInterval(autoPaly,20);
}
var san_san=document.getElementById("san-cott-xia-nei");
var san_si=document.getElementById("san-cott-xia");
var bool=true;
timers =setInterval(autoPalyyi,2000);
function autoPalyyi(){
//	sum-=4;
//	if(sum<=-730){
//		san_san.style.left=-730+"px";
//	}
//	else{
//		san_san.style.left=0;
// }
	setTimeout(function(){
		if (bool) {
			san_san.style.left=-730+"px";
		} else{
			san_san.style.left=0;
		}
		bool=!bool;
	},2000)
}
//点击事件
var shu01=document.getElementsByClassName("shu")[0].getElementsByTagName("span");
var shu02=document.getElementsByClassName("shu")[1].getElementsByTagName("span");
for (var i = 0; i < shu01.length; i++) {
	shu01[i].index=i;
	shu01[i].onclick=function(){
		for (var j = 0; j <shu01.length; j++) {
			shu01[j].style.backgroundColor="";
			san_yi.style.left=0;
		}
		this.style.backgroundColor="red";
		san_yi.style.left=-(this.index*730)+"px";
	}
}
for (var i = 0; i < shu02.length; i++) {
	shu02[i].index=i;
	shu02[i].onclick=function(){
		for (var j = 0; j <shu02.length; j++) {
			shu02[j].style.backgroundColor="";
			san_san.style.left=0;
		}
		this.style.backgroundColor="red";
		san_san.style.left=-(this.index*730)+"px";
	}
}
//$('.shu').eq(0).find('span').click(function(){
//	$('.shu').eq(0).find('span').css('background-color','');
//	$(this).css('background-color','red');
//})
//点击事件
//var si_yi=document.getElementsByClassName("si-xia-box")[0].getElementsByTagName("a");
//console.log(si_yi);
//for (var i = 0; i < si_yi.length; i++) {
//	si_yi[i].innerHTML="<img src='../img/aa"+i+".png'"
//}
//console.log(si_yi[i])
//热门品牌
var lis=document.getElementsByClassName("lis")[0].getElementsByTagName("a");
var divs=document.getElementsByClassName("si-xia-box");
//console.log(lis);
//console.log(divs);
for (var i = 0; i < lis.length; i++) {
	lis[i].index=i;
	lis[i].onclick=function(){
		for (var j = 0; j < lis.length; j++) {
			lis[j].style.color="";
			divs[j].style.display="none";
		}
		   this.style.color="#000";
		   divs[this.index].style.display="block";
	}
}
//热门品牌
//包邮专区
var lls=document.getElementsByClassName("wu-top-right")[0].getElementsByTagName("li");
var dvvs=document.getElementsByClassName("wu01");
for (var i = 0; i < lls.length; i++) {
	lls[i].index=i;
	lls[i].onclick=function(){
		for (var j = 0; j < lls.length; j++) {
			lls[j].style.color="";
			dvvs[j].style.display="none";
		}
		this.style.color="red";
		dvvs[this.index].style.display="block";
	}
}
//包邮专区
//精选市场
var los=document.getElementsByClassName("liu-top-right")[0].getElementsByTagName("li");
var dovs=document.getElementsByClassName("liu01");
//console.log(los);
//console.log(dovs);
for (var i = 0; i < los.length; i++) {
	los[i].index=i;
	los[i].onclick=function(){
		for (var j = 0; j < los.length; j++) {
			los[j].style.color="";
			dovs[j].style.display="none";
		}
		this.style.color="#ff5b00";
		dovs[this.index].style.display="block";
	}
}
//精选市场